<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use App\Repositories\GroupRepository;

class GroupRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|string|max:50',
            'logo' => 'max:1024|mimes:jpeg,bmp,png',
            'join_type' => 'required|in:'.implode(',', array_keys(GroupRepository::$joinTypes)),
            'join_password' => 'max:50',
            'copper' => 'required|integer|max:100000000',
            'description' => 'max:20000',
            'create_quiz_type' => 'required|in:'.implode(',', array_keys(GroupRepository::$createQuizTypes)),
        ];
    }
}
